package com.dongdongshop.service.impl;

import com.dongdongshop.mapper.TbAdminMapper;
import com.dongdongshop.pojo.TbAdmin;
import com.dongdongshop.pojo.TbAdminExample;
import com.dongdongshop.service.LoginService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
@DubboService
public class LoginServiceImpl implements LoginService {

    @Resource
    private TbAdminMapper adminMapper;

    @Override
    public TbAdmin getTbAdminList(String name) {
        TbAdminExample tbAdminExample = new TbAdminExample();
        TbAdminExample.Criteria criteria = tbAdminExample.createCriteria();
        criteria.andNameEqualTo(name);
        List<TbAdmin> tbAdmins = adminMapper.selectByExample(tbAdminExample);
        return tbAdmins==null? null : tbAdmins.get(0);
    }
}
